package com.structure.sort;

/**
 * 冒泡排序算法
 * @author David
 *
 */
public class Bubble {

	public static int[] array = new int[]{8,2,3,6,5,4,7,1,9,0};
	

	public static void bubbleSort(){
		for(int i=0;i<array.length;i++){
			for(int j=array.length-i;j<i;j--){
				if(array[i]>array[j]){
					int temp = array[i];
					array[i] = array[j];
					array[j] = temp;
				}
			}
		}
	}
	
	public static void print(){
		for(int i=0;i<array.length;i++){
			System.out.print(array[i]+" ");
		}
	}
	
	public static void main(String[] args){
		bubbleSort();
		print();
	}
	
}
